﻿using System;
using System.Collections.Generic;
using System.Web;
using ORS.DAL;
using System.Collections;

namespace ORS.BLL
{
    public class UserInfo
    {
        #region 私有成员
        private string _userid;
        private string _cname;
        private string _gender;
        private string _birthdate;
        private string _department;
        private string _regdate;
        private string _phonenum;
        private string _email;
        private string _roleid;
        private string _interestid;
        private string _password;
        private string _validflag;
 
        #endregion 私有成员

        #region 属性

        public string userid
        {
            set
            {
                this._userid = value;
            }
            get
            {
                return this._userid;
            }
        }

        public string cname
        {
            set
            {
                this._cname = value;
            }
            get
            {
                return this._cname;
            }
        }
        public string gender
        {
            set
            {
                this._gender = value;
            }
            get
            {
                return this._gender;
            }
        }
        public string birthdate
        {
            set
            {
                this._birthdate = value;
            }
            get
            {
                return this._birthdate;
            }
        }
        public string department
        {
            set
            {
                this._department = value;
            }
            get
            {
                return this._department;
            }
        }
        public string regdate
        {
            set
            {
                this._regdate = value;
            }
            get
            {
                return this._regdate;
            }
        }
        public string phonenum
        {
            set
            {
                this._phonenum = value;
            }
            get
            {
                return this._phonenum;
            }
        }
        public string email
        {
            set
            {
                this._email = value;
            }
            get
            {
                return this._email;
            }
        }
        public string roleid
        {
            set
            {
                this._roleid = value;
            }
            get
            {
                return this._roleid;
            }
        }
        public string interestid
        {
            set
            {
                this._interestid = value;
            }
            get
            {
                return this._interestid;
            }
        }
        public string password
        {
            set
            {
                this._password = value;
            }
            get
            {
                return this._password;
            }
        }
        public string validflag
        {
            set
            {
                this._validflag = value;
            }
            get
            {
                return this._validflag;
            }
        }
        #endregion 属性

        mssqlopr ivk_mssqlopr=new mssqlopr();
        public bool CheckUser(string user_name)
        {
            String sqlstr1= "SELECT * FROM tb_userlist WHERE userid='" + user_name + "'";
            
            if (!ivk_mssqlopr.find_User(sqlstr1))
            {
                return true;
            }
            else
            {

                return false;
            }
        }


        public static bool AddUserInfo(String TableName, Hashtable userInfo)
        {
            Database db = new Database();
            int Count = 0;

            if (userInfo.Count <= 0)
            {
                return true;
            }

            String Fields = " (";
            String Values = " Values(";
            foreach (DictionaryEntry item in userInfo)
            {
                if (Count != 0)
                {
                    Fields += ",";
                    Values += ",";
                }
                Fields += "[" + item.Key.ToString() + "]";
                Values += item.Value.ToString();
                Count++;
            }
            Fields += ")";
            Values += ")";

            String SqlString = "Insert into " + TableName + Fields + Values;

            String[] Sqls = { SqlString };
            return db.ExecuteSQL(Sqls);
            //Database db = new Database();		//实例化一个Database类

        }





    }
}